package day06;

import java.util.Arrays;

public class ArrayDemo {
    public static void main(String[] args) {
        /*
         数组排序的练习

         要求：声明整型数组并填充数据，排序，输出排序后数据，倒序输出数据
        * */
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int)(Math.random() * 100);
        }
        Arrays.sort(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();
        for (int i = arr.length - 1; i >= 0; i--) {
            System.out.print(arr[i] + " ");
        }
    }
}
